<?
	$facadeClass = 'switch48port';
	switch ($device->os->getPhysicalPortsCount()) {
		case 48:
		case 50:
			$facadeClass = 'switch48port';
			break;	
		case 24:
		case 26:
			$facadeClass = 'switch24port';
			break;			
	}

?>
<div>
	<h3 class="iconInterfaces">Port Status</h3>
	<div class="device_facade <?=$facadeClass?>">
		<div class="section section1"></div>
		<div class="section section2"></div>
		<div class="section section3"></div>
<?
	$i = 1;
	$j = 1;
	foreach ($device->interfaces AS $port) {
		switch ($port->ifType) {
			case 117:
			case 6:
				echo '<div class="led led'.$i.' '.($i%2?'odd':'even').' ';
				switch ($port->getHighSpeed(false)) {
					case '1000': echo 'gigabit'; break;
					case '100': echo 'ethernet'; break;
				}
				echo '"></div>';				
				echo '<a href="#port'.$port->ifIndex.'" title="Click to View Port Details"v class="port port'.$i.' '.($i%2?'odd':'even').' '.$port->getStatus().'"></a>';
				echo '<div class="label label'.$i.' '.($i%2?'odd':'even').'">'.$i.'</div>';
				$i++;
				break;			
		}
	
	}
?>
	</div>
</div>

<table width="100%">
	<thead>
		<tr>
			<th>&nbsp;</th>
			<th align="left" >Network Interface</th>
			<th width="100">Throughput</th>
			<th>Traffic <span>(Past 24hrs)</span></th>
			<th width="180">Port Type</th>
			<th width="20">&nbsp;</th>
		</tr>
	</thead>
<?
$odd=false;
foreach ($device->interfaces AS $interface) {
		echo '<tr class="'.($odd?'odd':'').' '.($interface->ignore?'ignore':'').'">';
			echo '<td>';
			if ($interface->ifType == 6 || $interface->ifType == 117) {
				echo '<div class="port '.$interface->getStatus().'">&nbsp;</div>';
			} else {
				echo '&nbsp;';
			}
			echo '</td>';
			echo '<td class="title"><a name="port'.$interface->ifIndex.'".href="/device/'.$device->id.'/interface/'.$interface->ifIndex.'/" >'.$interface->getDescription().'</a>';
			echo '<span>'.$interface->getType().'</span>';
			echo '</td>';
			echo '<td class="rate">';
				echo '<div class="in">'.$interface->getCurrentThroughput('in').'/s</div>';
				echo '<div class="out">'.$interface->getCurrentThroughput('out').'/s</div>';
			echo '</td>';
			echo '<td>';
			if (!$interface->ignore && $interface->getStatus() == 'up') {
				echo '<img class="graph" src="/graph.php?device='.$device->id.'&interface='.$interface->ifIndex.'&type=interfaceTraffic&width=200&height=40&legend=0"/>';
			} else echo '&nbsp;';
			echo '</td>';
			echo '<td class="info">';
				$info = array();
				$speed = $interface->getSpeed();
				if (!empty($speed)) {$info[] = '<b>Link Speed:</b> '.$interface->getSpeed();}
				if (!empty($interface->ifPhysAddress)) {$info[] = '<b>MAC:</b>'.$interface->ifPhysAddress;}
				if ($interface->ifMtu > 0) { $info[]=  '<b>MTU:</b>'.$interface->ifMtu;}
				echo implode('<br/>',$info);
			echo '</td>';
			echo '<td><a href="/device/'.$device->id.'/interface/'.$interface->ifIndex.'/" class="btn" >More...</a></td>';
		echo '</tr>';
		$odd = !$odd;
}


?>
</table>